package com.bookhouse.action;

import java.util.List;

import com.bookhouse.domain.ReaderType;
import com.bookhouse.service.ReaderTypeService;
import com.opensymphony.xwork2.ActionSupport;

public class ReaderTypeAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private ReaderTypeService readerTypeService;

	public void setReaderTypeService(ReaderTypeService readerTypeService) {
		this.readerTypeService = readerTypeService;
	}

	private List<ReaderType> list;
	private ReaderType readerType = new ReaderType();
	private String readerTypeId;

	public List<ReaderType> getList() {
		return list;
	}

	public void setList(List<ReaderType> list) {
		this.list = list;
	}

	public ReaderType getReaderType() {
		return readerType;
	}

	public void setReaderType(ReaderType readerType) {
		this.readerType = readerType;
	}

	public String getReaderTypeId() {
		return readerTypeId;
	}

	public void setReaderTypeId(String readerTypeId) {
		this.readerTypeId = readerTypeId;
	}

	public String saveReaderType() throws Exception {
		readerTypeService.saveReaderType(readerType);
		return "saveReaderType";
	}

	public String getReaderTypeList() throws Exception {
		list = readerTypeService.getAllReaderType();
		return "getReaderTypeList";
	}

	public String getReaderTypeEdit() throws Exception {
		readerType = readerTypeService.getReaderType(Integer.parseInt(readerTypeId));
		return "getReaderTypeEdit";
	}

	public String deleteReaderType() throws Exception {
		readerTypeService.deleteReaderType(Integer.parseInt(readerTypeId));
		return "deleteReaderType";
	}

}
